<?php
/**
 * Misc Controller
 * @author Sokha RUM
 *
 */
class Main extends Kcontroller {
	function login() {
		//$this->load_language("login");
		$data = array();
		$error_message = Ksession::getFlash("message");
		$data["error_message"] = $error_message;
		$this->load->template('templates/general','main/login', "Login Page", $data);
	}
	
	function index() {
		$data = array();
		/*$user = Ksession::getUser();
		$data = array();
		$data["tabid"] = isset($_GET["tabid"]) ? $_GET["tabid"] : 0;
		if ($user["grp_id"] == Kconstant::USER_SYSTEM)
	    {
			$this->load->model("msystem");
			$companies = $this->msystem->getInfoCompanies();
			$data = array();
			$data["success"] = Ksession::getFlash("success");
			$data["companies"] = $companies;
			$this->load->template('templates/general','main/homepage_system', '', $data);
       	} else {
			$this->load->template('templates/general','main/homepage', '', $data);
       	}*/
		$this->load->template('templates/general','main/homepage', '', $data);
	}
	
	function logout() {
		Ksession::destroy();
		redirect(site_url());
	}
	
	function applicationexpire() {
		
		$user = Ksession::getUser();
		$data = array();
		$data["tabid"] = isset($_GET["tabid"]) ? $_GET["tabid"] : 0;
		$this->load_language("login");							/* xavier le 28/12/2011 */
		
		
		$this->load->template('templates/login','main/contract_expired', k_lang("login_button_contract"), $data);
	}

	function errorpage() {
		$this->load_language("login");							/* xavier le 28/12/2011 */
		$data = array();
		$error_message = Ksession::getFlash("message");
		$data["error_message"] = $error_message;
		
		$this->load->template('templates/login','main/error_page', k_lang("error_page"), $data);
	}
}
